/**
 * 
 */
package fr.gfi.agraf.persistence.entity;

import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Type;

/**
 * @author eleve
 * 
 */
@Entity
public class Tache {

	@Id
	@GeneratedValue
	private Long id;

	@Column(nullable = false)
	private Double chargeInit;

	@Column(nullable = false)
	private String libelle;

	@Type(type="text")
	private String commentaire;

	@Temporal(TemporalType.DATE)
	private Date dateDebut;

	@Temporal(TemporalType.TIMESTAMP)
	private Date dateFin;

	@Temporal(TemporalType.TIMESTAMP)
	@Column(nullable = false)
	private Date dateCreation;

	@ManyToOne
	@JoinColumn(name = "idActivite", nullable = false)
	private Activite activite;

	@ManyToOne
	@JoinColumn(name = "idUtilisateur", nullable = true)
	private Utilisateur utilisateur;

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tache")
	private Set<Saisie> listeSaisies;

	@ManyToOne
	@JoinColumn(name = "idEtat", nullable = false)
	private Etat etat;

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(final Long id) {
		this.id = id;
	}

	/**
	 * @return the chargeInit
	 */
	public Double getChargeInit() {
		return chargeInit;
	}

	/**
	 * @param chargeInit
	 *            the chargeInit to set
	 */
	public void setChargeInit(final Double chargeInit) {
		this.chargeInit = chargeInit;
	}

	/**
	 * @return the libelle
	 */
	public String getLibelle() {
		return libelle;
	}

	/**
	 * @param libelle
	 *            the libelle to set
	 */
	public void setLibelle(final String libelle) {
		this.libelle = libelle;
	}

	/**
	 * @return the commentaire
	 */
	public String getCommentaire() {
		return commentaire;
	}

	/**
	 * @param commentaire
	 *            the commentaire to set
	 */
	public void setCommentaire(final String commentaire) {
		this.commentaire = commentaire;
	}

	/**
	 * @return the dateDebut
	 */
	public Date getDateDebut() {
		return dateDebut;
	}

	/**
	 * @param dateDebut
	 *            the dateDebut to set
	 */
	public void setDateDebut(final Date dateDebut) {
		this.dateDebut = dateDebut;
	}

	/**
	 * @return the dateFin
	 */
	public Date getDateFin() {
		return dateFin;
	}

	/**
	 * @param dateFin
	 *            the dateFin to set
	 */
	public void setDateFin(final Date dateFin) {
		this.dateFin = dateFin;
	}

	/**
	 * @return the dateCreation
	 */
	public Date getDateCreation() {
		return dateCreation;
	}

	/**
	 * @param dateCreation
	 *            the dateCreation to set
	 */
	public void setDateCreation(final Date dateCreation) {
		this.dateCreation = dateCreation;
	}

	/**
	 * @return the activite
	 */
	public Activite getActivite() {
		return activite;
	}

	/**
	 * @param activite
	 *            the activite to set
	 */
	public void setActivite(final Activite activite) {
		this.activite = activite;
	}

	/**
	 * @return the utilisateur
	 */
	public Utilisateur getUtilisateur() {
		return utilisateur;
	}

	/**
	 * @param utilisateur
	 *            the utilisateur to set
	 */
	public void setUtilisateur(final Utilisateur utilisateur) {
		this.utilisateur = utilisateur;
	}

	/**
	 * @return the listeSaisies
	 */
	public Set<Saisie> getListeSaisies() {
		return listeSaisies;
	}

	/**
	 * @return the etat
	 */
	public Etat getEtat() {
		return etat;
	}

	/**
	 * @param etat
	 *            the etat to set
	 */
	public void setEtat(final Etat etat) {
		this.etat = etat;
	}

	/**
	 * @param listeSaisies
	 *            the listeSaisies to set
	 */
	public void setListeSaisies(final Set<Saisie> listeSaisies) {
		this.listeSaisies = listeSaisies;
	}

}
